package logo.utils;

import logo.sys.*;
import javax.swing.*;

public class TestDisplay {
    TurtleDisplay td;

    public static void main(String[] args) {
	int width = 400;
	int height = 400;

	switch (args.length) {
	case 0: break;
	case 2: height = Integer.parseInt(args[1]);
	case 1: width = Integer.parseInt(args[0]); break;
	}
	
	JFrame frame = Logo.makeWindow(width, height);
	
	TurtleDisplay test = new TurtleDisplay(frame);
	frame.getContentPane().add(test);
	frame.setVisible(true);

	test.showTurtle(0D, -50D, -50D);
	try {
	    while(true) {
		for (double v = -75; v <= 75; v = v + 5) {
		    test.showTurtle(v/100 * 2 * Math.PI, 0, 0);
		    test.drawSegment(v, -75D, v + 10, 75D);
		    Thread.currentThread();
			Thread.sleep(100);
		}
		test.clear();
		Thread.currentThread();
		Thread.sleep(1000);
	    }
	} catch (InterruptedException ie) {
	    System.out.println("Interrupted! " + ie.getMessage());
	}
    }
}
